package com.panfeng.xcloud.scheduler.util.tron;

import com.alibaba.fastjson.JSONObject;
import org.tron.common.crypto.ECKey;
import org.tron.common.utils.ByteArray;
import org.tron.common.utils.Utils;

import static com.panfeng.xcloud.scheduler.util.tron.AddressHelper.addressBytesEncode58Check;

public class Trc20Address {
       public JSONObject gettrc20address(){
        ECKey eCkey = new ECKey(Utils.getRandom());
        String privateKey = ByteArray.toHexString(eCkey.getPrivKeyBytes());
        byte[] addressBytes = eCkey.getAddress();
        String base58checkAddress = addressBytesEncode58Check(addressBytes);
        JSONObject json=new JSONObject();
        json.put("privateKey", privateKey);
        json.put("address", base58checkAddress);
        return json;
    }
}
